var p1 = $.ajax({
    type:'get',
    url:'/posts/count',
})

var p2 = $.ajax({
    type:'get',
    url:'/categories/count',
})

var p3 = $.ajax({
    type:'get',
    url:'/comments/count',
})

// done 只有前面所有的ajax全部请求数据成功才会触发
$.when(p1,p2,p3).done(function(res1,res2,res3){
    // console.log(res1)
    // console.log(res2)
    // console.log(res3)
    var str1 = `<strong>${res1[0].postCount}</strong>篇文章（<strong>${res1[0].draftCount}</strong>篇草稿）`
    var str2 = `<strong>${res2[0].categoryCount}</strong>个分类`
    var str3 = `<strong>${res3[0].commentCount}</strong>条评论`
    $('#content li').eq(0).html(str1)
    $('#content li').eq(1).html(str2)
    $('#content li').eq(2).html(str3)
})